/******************************************************************************* 
  Copyright (C), 1988-2020, zeno Tech. Co., Ltd.
  Description:  CFG模块中驱动和应用层对外接口都需要引用的定义
  Function List:
  
*******************************************************************************/
#ifndef CFG_COMM_H 
#define CFG_COMM_H 

#ifdef __cplusplus
extern "C" {
#endif

/*=============================================================================
                                 Includes                                  
==============================================================================*/


/*=============================================================================
                               Macro Definition
==============================================================================*/
#define CFG_MTD_NAME_LEN    16
#define CFG_MTD_NUM         16

                        
/*=============================================================================
                        Local Structures and Typedef 
==============================================================================*/
/* hwid信息 */
typedef struct
{
    char hwid[8]; 		/* hwid值 */
    char mac0[6];		/* 第一块网卡信息 */
    char mac1[6];		/* 第二块网卡信息 */
    char isEncrypt;		/* 是否加密 */
} CFG_hwidInfo_t;


/* 分区信息 */
typedef struct 
{
    char name[CFG_MTD_NAME_LEN];        /* identifier string */
    unsigned long long size;            /* partition size */
    unsigned long long offset;          /* offset within the master MTD space */
    unsigned int flag;                  /* 分区读写权限, 定义见TAG_mtdFlag_t */
    unsigned int cs;                    /* spi flash chip select */
    unsigned int fsFlags;               /* 文件系统读写权限, 定义见fs_flag */
    unsigned int fsType;                /* 文件系统类型，定义见TAG_fsType_t */
    unsigned int reserved[16];
} CFG_mtd_t;


/* 分区表信息 */
typedef struct
{
    unsigned int mtdNum;                    /* 分区个数 */
    CFG_mtd_t mtdArrag[CFG_MTD_NUM];        /* 分区信息数组 */
    
    unsigned long long envSize;             /* env 分区大小  */
    unsigned long long envOffset;           /* env 分区偏移地址 */

    unsigned long long hwidSize;           /* hwid 分区大小 */
    unsigned long long hwidOffset;         /* hwid 分区偏移地址 */
} CFG_mtds_t;


/* 启动参数 */
typedef struct
{
    unsigned char xapp;
    unsigned char xuart;
	unsigned char xload;
	unsigned char ethaddr[18];
	unsigned char ip[16];
	unsigned char netmask[16];
	unsigned char gateway[16];
	int fd;
	int debug;
	unsigned int logBufBase;
	unsigned int logBufSize;
	unsigned char ifType;              /* phy芯片接口类型，定义见TAG_phyType_t */
	unsigned char ethaddr2[18];
	unsigned char reserved[37];        /*reversed for future*/
} CFG_bootpara_t;


/*=============================================================================
                             extern  Variables                                  
==============================================================================*/

#ifdef __cplusplus
}
#endif
#endif /* CFG_COMM_H */

